package com.yuyue.dronesystem.entities;

import java.util.Objects;

import javax.persistence.Embeddable;

/**
 * Coordinate
 */
@Embeddable
public class Coordinate {

    private Double longitude;
    private Double latitude;

    public Coordinate() {
    }

    public Coordinate(Double longitude, Double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
    }

    public Double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public Double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Coordinate longitude(Double longitude) {
        this.longitude = longitude;
        return this;
    }

    public Coordinate latitude(Double latitude) {
        this.latitude = latitude;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof Coordinate)) {
            return false;
        }
        Coordinate coordinate = (Coordinate) o;
        return Objects.equals(longitude, coordinate.longitude) && Objects.equals(latitude, coordinate.latitude);
    }

    @Override
    public int hashCode() {
        return Objects.hash(longitude, latitude);
    }

    @Override
    public String toString() {
        return "{" +
            " longitude='" + getLongitude() + "'" +
            ", latitude='" + getLatitude() + "'" +
            "}";
    }    
}